# -*- coding: utf-8 -*- 
# @Time : 2021/10/23 23:47 
# @Author : Dong 
# @File : marshal_json.py

from flask_restful import fields

json_template = {
    'users_fields':{
        'id':fields.Integer,
        'name':fields.String,
        'mobile':fields.String,
        'real_name':fields.String,
        'id_card':fields.String,
        'avatar_url':fields.String,
        'create_time':fields.DateTime
    },
    "houses_fields":{
        'id':fields.Integer,
        'user_id':fields.String,
        'area_id':fields.String,
        'title':fields.String,
        'price':fields.String,
        'address':fields.String,
        'room_count':fields.String,
        'acreage':fields.String,
        'unit':fields.String,
        'capacity':fields.String,
        'beds':fields.String,
        'deposit':fields.String,
        'min_days':fields.String,
        'max_days':fields.String,
        'create_time':fields.DateTime
    }
}

def data_fields(fields_template):
    return {
        'errmsg':fields.String,
        'errno':fields.String,
        'data':fields.Nested(json_template.get(fields_template))
    }